import time
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By

@pytest.fixture(scope='class')
def driver():
    driver = webdriver.Firefox()
    driver.get('http://10.59.9.12:7001/')
    driver.maximize_window()
    yield driver
    time.sleep(3)
    driver.quit()

def test_login(self,driver):
    driver.find_element(By.XPATH, '/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
    time.sleep(4)
    dy = driver.find_element(By.LINK_TEXT,'登录成功').text
    print("断言：",dy)
    assert "登录成功" == dy
    driver.find_element(By.NAME, 'username').send_keys('13811033962')
    driver.find_element(By.NAME, 'password').send_keys('123456')
    time.sleep(15)
    driver.find_element(By.XPATH, '/html/body/div[4]/div/div[1]/div[2]/form/div[5]/a').click()
    time.sleep(5)